/****************************************************/
// Theme name: Nexus - Bootstrap Admin Template
// Theme URI: http://nexus.lethemes.net/1.0/html/
// Description: Nexus is a fully responsive admin dashboard template
// Tags: admin, admin dashboard, cms, crm, project managerment, responsive, webapp, backend, bootstrap admin, responsive admin
// Author: Loi Le
// Version: 1.0
/****************************************************/

sparklineBar('#bar-chart-1', [50, 60, 70, 20, 0, 40, 20, 40, 10, 80, 50, 40], '48', 8, 1, '#FFF', '#FFF');
sparklineLine('#line-chart-1', [10, 20, 14, 30, 14, 20, 30, 15, 20, 0, 16, 5],
    '110', '48', '#FFF', false, 2, '#FFF', '#FFF', '#FFF', '#FFB61E', '#FFB61E', 4);
sparklineBar('#inquiries-chart-2', [50, 60, 70, 70, 60, 40, 50, 40, 40, 80, 50, 40], '48', 8, 5, '#26C281', '#26C281');

function year(year) {
    return new Date(year, 1, 1).getTime();
}

var dataLine1 = [
    [year(2010), 5.8],
    [year(2011), 8.5],
    [year(2012), 7.8],
    [year(2013), 9.6],
    [year(2014), 7.5]
];

var datasetLine = [{
    label: "Revenue",
    data: dataLine1,
    points: {
        symbol: "diamond"
    },
    color: "#FFF"
}];
var optionsLine = {
    series: {
        lines: {
            show: true,

        },
        points: {
            fill: true,
            show: true
        }
    },
    grid: {
        borderWidth: 0,
        hoverable: true,
        tickColor: "rgba(0,0,0,0)",
    },
    xaxis: {
        font: {
            color: '#FFF',
            size: 12
        },
        mode: "time",
        tickSize: [1, "year"],
        timeformat: "%Y",
    },
    yaxes: [{
        font: {
            color: '#FFF',
            size: 12
        },
        tickFormatter: function(v, axis) {
            return v.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",") + 'k';
        },
    }],
    tooltip: true,
    tooltipOpts: {
        content: "%s: %y in %x",
        shifts: {
            x: -60,
            y: 25
        },
        defaultTheme: false
    },
    legend: false
};
$.plot($("#revenue-chart"), datasetLine, optionsLine);

// Area Chart
// --------------------------------------------------
var areaChartData = [{
    label: 'Visits',
    data: [
        [00, 300],
        [01, 400],
        [02, 600],
        [03, 700],
        [04, 400],
        [05, 500],
        [06, 800],
        [07, 500],
        [08, 900],
        [09, 600],
        [10, 800],
        [11, 600],
        [12, 500]
    ],
    color: '#3B40CE',
    lines: {
        fillColor: '#3B40CE'
    }
}, {
    label: 'Returning Visits',
    data: [
        [00, 200],
        [01, 250],
        [02, 400],
        [03, 550],
        [04, 300],
        [05, 400],
        [06, 400],
        [07, 200],
        [08, 100],
        [09, 400],
        [10, 300],
        [11, 400],
        [12, 200]
    ],
    color: '#6C70DA',
    lines: {
        fillColor: '#6C70DA'
    }
}];
var areaChartOptions = {
    series: {
        lines: {
            show: true,
            fill: true,
        },
        points: {
            show: true
        }
    },
    grid: {
        borderWidth: 0,
        hoverable: true,
        tickColor: "#DDD",
    },

    tooltip: true,
    tooltipOpts: {
        content: "%s: %y visitors at %x:00",
        shifts: {
            x: -60,
            y: 25
        },
        defaultTheme: false
    },
    legend: {
        show: false
    }
};
$.plot($("#area-chart-1"), areaChartData, areaChartOptions);